# $Id: PKGBUILD 90104 2013-05-06 19:40:01Z foutrelis $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Slash <demodevil5[at]yahoo[dot]com>
# Contributor: Babets
# Contributor: Vain

pkgname=warsow
pkgver=1.02
pkgrel=2
pkgdesc="Free online multiplayer competitive FPS based on the Qfusion engine"
url="http://www.warsow.net/"
license=('GPL')
arch=('i686' 'x86_64') 
depends=('curl' 'libjpeg' 'libvorbis' 'libxinerama' 'libxxf86dga' 'libxxf86vm' 'sdl' 'warsow-data' 'libxrandr' 'libpng' 'libtheora')
makedepends=('mesa' 'openal' 'imagemagick' 'gendesk')
optdepends=('openal: for openal audio support')
source=('warsow.launcher' 'wsw-server.launcher' 'wswtv-server.launcher' \
        "http://wsw.null.so/warsow_${pkgver}_sdk.tar.gz")
_genericname=('First person shooter')
_comment=('Online Mulitiplayer Competitive FPS')
md5sums=('ec00081d81ad9802a8ca42fc2eac5498'
         'f73e10c26197178df71b941b10bf83d7'
         'd7e4a69835bbcf801e58307e9d6b951e'
         'df3dee05dd6f84b44ba131a2445a1706')

build() {
  cd "$srcdir"
	gendesk -n

  # This was used to fix some crashing due to alignment problems before. Has upstream
  # finally got their shit together and we don't need them anymore?
  #unset CFLAGS
	#unset CXXFLAGS

  # Compile Warsow
  cd $srcdir/warsow_${pkgver}_sdk/source/
  make -j1
}

package() {
  cd $srcdir/warsow_${pkgver}_sdk/source/
  
  # Create Destination Directories
  install -d $pkgdir/opt/warsow/

  # Move Compiled Data to Destination Directory
  cp -r $srcdir/warsow_${pkgver}_sdk/source/release/* $pkgdir/opt/warsow

  install -D -m 0755 $srcdir/warsow.launcher $pkgdir/usr/bin/warsow
  install -D -m 0755 $srcdir/wsw-server.launcher $pkgdir/usr/bin/wsw-server
  install -D -m 0755 $srcdir/wswtv-server.launcher $pkgdir/usr/bin/wswtv-server
  install -D -m 0644 $srcdir/warsow.desktop $pkgdir/usr/share/applications/warsow.desktop
  convert $srcdir/warsow_${pkgver}_sdk/source/win32/warsow.ico $srcdir/warsow.png
  install -D -m 0644 $srcdir/warsow-0.png $pkgdir/usr/share/pixmaps/warsow.png
}

# vim: ts=2:sw=2
